package 核心API的使用;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class TestSimpleDateFormat {
    public static void main(String[] args) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss");
        Date date = new Date();
        System.out.println(sdf.format(date));
        System.out.println(sdf1.format(date));

        Calendar calendar = Calendar.getInstance();
        calendar.set(2020,Calendar.MONTH,31,10,23,45);
        System.out.println(sdf.format(calendar.getTime()));
        System.out.println(sdf1.format(calendar.getTime()));

        String birth = "1999/03/28/ 07:00:00";
        try {
            Date birDate = sdf1.parse(birth);
            System.out.println(birDate);
        } catch (ParseException e) {
            e.printStackTrace();
        }

    }
}